﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SL8.SL.ViewModels;
using SL8.SL.Commands;

namespace SL8.SL
{
    public class TaskCalendarDayItemInfo : ObservableObject
    {
        public event EventHandler Selected;

        public DateTime Date
        {
            get
            {
                return this.GetCacheValue(o => o.Date, default(DateTime));
            }
            set
            {
                this.SetCacheValue(o => o.Date, value);
                this.RaisePropertyChanged(o => o.Date);
            }
        }

        public bool IsCurrentMonth
        {
            get
            {
                return this.GetCacheValue(o => o.IsCurrentMonth, false);
            }

            set
            {
                this.SetCacheValue(o => o.IsCurrentMonth, value);
                this.RaisePropertyChanged(o => o.IsCurrentMonth);
            }
        }

        public bool IsCurrentDay
        {
            get
            {
                return this.GetCacheValue(o => o.IsCurrentDay, false);
            }

            set
            {
                this.SetCacheValue(o => o.IsCurrentDay, value);
                this.RaisePropertyChanged(o => o.IsCurrentDay);
            }
        }

        public bool IsWorkDay
        {
            get
            {
                return this.GetCacheValue(o => o.IsWorkDay, false);
            }

            set
            {
                this.SetCacheValue(o => o.IsWorkDay, value);
                this.RaisePropertyChanged(o => o.IsWorkDay);
            }
        }

        public bool IsChecked
        {
            get
            {
                return this.GetCacheValue(o => o.IsChecked, false);
            }

            set
            {
                this.SetCacheValue(o => o.IsChecked, value);
                this.RaisePropertyChanged(o => o.IsChecked);
            }
        }

        public int TaskCount
        {
            get
            {
                return this.GetCacheValue(o => o.TaskCount, 0);
            }

            set
            {
                this.SetCacheValue(o => o.TaskCount, value);
                this.RaisePropertyChanged(o => o.TaskCount);
            }
        }

        public bool IsPass
        {
            get
            {
                return this.GetCacheValue(o => o.IsPass, false);
            }

            set
            {
                this.SetCacheValue(o => o.IsPass, value);
                this.RaisePropertyChanged(o => o.IsPass);
            }
        }

        public ICommand SelectedCommand
        {
            get
            {
                return this.GetCacheValue(o => o.SelectedCommand, () =>
                {
                    return new DelegateCommand(this.OnSelectedCommand);
                });
            }
        }

        private void OnSelectedCommand(object arg)
        {
            if (this.Selected != null)
            {
                this.Selected(this, null);
            }
        }
    }
}
